/**
 * Created by Administrator on 2017-02-08.
 */
const fs = require('fs');
const path = require('path')



exports.mkdirsSync = function mkdirsSync(dirpath, mode) {
    if (!fs.existsSync(dirpath)) {
        var pathtmp;

        dirpath.split(path.sep).forEach(function(dirname) {
            if (pathtmp) {
                pathtmp = path.join(pathtmp, dirname);
            }
            else {
                pathtmp = dirname;
            }
            //console.log(pathtmp)
            if (!fs.existsSync(pathtmp)) {
                console.log(pathtmp)
                if (!fs.mkdirSync(pathtmp, mode)) {
                    return false;
                }
            }
        });
    }
    return true;
}